package com.lkm.app_ui.m.Imple.fun;

import com.lkm.app_ui.AppConst;
import com.lkm.app_ui.RunTimeData;
import com.lkm.app_ui.m.fun.FunModule;
import com.lkm.frame.module.ConditionConfige;
import com.lkm.frame.module.ModuleDelegate;
import com.lkm.frame.module.ModuleManager;
import com.lkm.frame.task2.Task;
import com.lkm.frame.task2.TaskAdapter;
import com.lkm.market2_0.m.app_main.AppMainModule;
import com.lkm.market2_0.task.DefaultTaskExecutor;


public class FunModuleDelegate implements ModuleDelegate<FunModule, Void> {



    public static void OnSteelardInfoLoadOK(){
        if(watingSteelardInfoLoadOK!=null){
            watingSteelardInfoLoadOK.complete(null);
        }
    }

    @Override
    public void init(ModuleManager moduleManager) {

    }


    private static Task watingSteelardInfoLoadOK;
    @Override
    public void dependency(DependencyConfig dc) {
        dc.addDependency(AppMainModule.class);



        if(RunTimeData.steelyardInfo == null) {

        watingSteelardInfoLoadOK = new TaskAdapter(new DefaultTaskExecutor(true),"watingSteelardInfoLoadOK", AppConst.getTaskManager2()){
            @Override
            public boolean onInterceptEnd(boolean isCancel, Object result) {
                watingSteelardInfoLoadOK = null;
                return super.onInterceptEnd(isCancel, result);
            }
        };
        dc.getModuleBoot().dependency(watingSteelardInfoLoadOK);
        watingSteelardInfoLoadOK.action();
        watingSteelardInfoLoadOK.execTask();
        }

    }

    @Override
    public void configure(ConditionConfige<Void> cc) {

    }

    @Override
    public FunModule execute(Void aVoid) {
        return new FunModuleImple();
    }

    @Override
    public Class<FunModule> getModuleInterfaceClass() {
        return FunModule.class;
    }

    @Override
    public void onError(ErrorWarp e) {

    }
}
